<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title></title>
	<style>
		body{
			margin:0;
			padding:0;
		}
		
		#main{
			border:1px dotted #ff0000;
			width:500px;
			margin:50px;
		}
		#rect{			
			border:10px solid #ff0000;			
			position:fixed;
			left:120px;
			top:100px;
		}
	</style>
	   
	<script  type="text/javascript" src="../libs/jquery-1.7.1.min.js"></script>
	<script>
		
		var rect;
		var main;
		var nSW = 5;
		window.onload=function(){
			rect = document.getElementById("rect");
			main = document.getElementById("main");
			
			showInfo();
			
			createData();
			setMove();
		}
		
		function createData(){
			var strInfo = "";
			for(var i=0;i<100;i++){
				strInfo += i+"<br>";
			}		
			main.innerHTML = strInfo;
		}
		
		function showInfo(){
			var strInfo = "";
			strInfo += '$("document").width() = '+$(document).width()+"<br>";
			strInfo += '$("document").height() = '+$(document).height()+"<br>";
			
			var objDOM = window.document;		
			rect.innerHTML = strInfo;
		}
		
		function on_Change(){
			showInfo();
		}
		
		
		function setMove(){
			setInterval(moveX, 20);	
		}
		
		function moveX(){
			autoScroll();
			showInfo();
		}
		
		function autoScroll(){
			var nY = window.pageYOffset;
			var nMaxTop	= window.document.documentElement.scrollHeight-window.innerHeight;
			
			if(nY+nSW>nMaxTop){
				nSW = -5;
			}
			
			if(nY+nSW<0){
				nSW = 5;
			}
			
			
			nY += nSW;	
			window.scrollTo(0,nY);		
		}
	</script>
</head>

<body>
<div id="main">             
</div>
<div id="rect">                   
</div>
</body>
</html>
